import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		appName: 'ckej',
		isShowAds:true,
		city:'淮安',
		bak: '4aicWYPVLUpBrrr5adlkuNehFaeyEzc7',
		akey:'1b1799fd4900a13c985907e650045d24',
		position: {
			lat:'',
			lng:''
		},
		userInfo: {}
	},
	getters: {
		isLogin: state => Object.keys(state.userInfo).length > 0	//是否登录
	},
	mutations: {
		SET_iS_SHOW_ADS(state,isShowAds){
			state.isShowAds = isShowAds
		}
		,SET_POSITION(state,position){
			state.position = position
		}
		,SET_USER_INFO(state,userInfo){
			state.userInfo = userInfo
		}
	},
	actions: {
		// async getStore({commit}) {
		// 	const store = await api('store')
		// 	commit('SET_STORE', store)
		// }
	}
})

export default store